<template>
	<view class="pay">
		<view class="icon">
			<u-icon name="list" size="30px"></u-icon>
		</view>
		<view class="p2" v-for="item in list" :key="item.id">
			<text>{{item.liveName}}</text>
			<text>手机号：{{phonenumber}}</text>
			<view class="choose">
				<text style="color: red; margin-left: -150px;">交费选择：</text>
				<u-radio-group>
				    <u-radio v-for="(li, index) in list1" :key="index" :label="li.choose" :name="li.choose" style="margin-right: 20px; margin-top: 20px;" @change="clickpay"></u-radio>
				</u-radio-group>
			</view>
			<image :src="'http://124.93.196.45:10001'+item.imgUrl" style="width: 70px; height: 70px; margin-top: 30px;"></image>
			<u-button type="error" text="支付" style="width: 70px; margin-top: 20px; height: 30px;" @click="pay"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				phonenumber:'',
				list1:[
					{
						choose:'50',
						disabled:false
					},
					{
						choose:"100",
						disabled:false
					},
					{
						choose:"200",
						disabled:false
					}
				],
				key:'',
			}
		},
		onLoad(options) {
			this.phonenumber=options.number
			 console.log(options)
			 this.gettype()
		},
		methods: {
			// 获取交费类型
			gettype(){
				this.api.get('/prod-api/api/living/category/list').then(res=>{
					this.list=res.data.data
				})
			},
			clickpay(e) {
				this.key=e
			   console.log(e)
			},
			pay(){
				if(this.key===''){
					uni.showToast({
						title:'金额为0',
						icon:'error'
					})
				}else{
					uni.showToast({
						title:'支付成功',
						icon:'success'
					})
				}
			}
	},
}
</script>

<style lang="scss">
.icon{
	// width: 300px;
	// float: right;
	// margin-right: 10px;
}
.p2{
	width: 250px;
	height: 300px;
	border: 1px solid #aaaaff;
	margin: 30px auto;
	border-radius: 20px;
	display: flex;
	flex-direction: column;
	text-align: center;
	line-height: 30px;
	align-items: center;
}
</style>
